import random


def rand(start, end):
  if not str(start).isdigit():
    print("start不是正整数！")
    raise ValueError("start应该是正整数！")
  elif not str(end).isdigit():
    print("end不是正整数！")
    raise ValueError("end应该是正整数！")
  elif start >= end:
    print("start和end的大小错误！")
    raise ValueError("end的值应该大于start")
  else:
    print(f"生成随机数：{random.randint(start, end)}")


if __name__ == '__main__':
    try:
      rand(3, 5.7)
    except ValueError as e:
      print(f"传入的范围错误：{e}")

    try:
      rand(8, 2)
    except ValueError as e:
      print(f"传入的范围错误：{e}")

